<?php
$db = new Database;
$auth = Auth::getAuth('current_user');
$user_id = $auth['id'];
$company_id = $auth['company_id'];
if(isset($_POST['action'])){
    if($_POST['action']=="getFormTitle"){
        $request_id = $_POST['request_id'];
        $getFormTitle = $db->query("SELECT * FROM tbrequest r LEFT JOIN tbform f on r.form_id = f.id where r.id = '$request_id'","row");
        echo $getFormTitle['form_title'];
    }else if($_POST['action']=="getFormData"){
        $request_id = $_POST['request_id'];
        $getFormValues = $db->query("SELECT * FROM tbrequest where id = '$request_id'","row");
        $getDataArray = explode("~",$getFormValues['data']);
        ?>
        <table width=300>
        <?php
        for($c=0;$c<count($getDataArray)-1;$c++){
            $dataLabel = explode("->",$getDataArray[$c]);
            $getLabel = $db->query("SELECT * FROM tbfield_output where id = '$dataLabel[0]'","row");
            $comma = "";
            echo "<tr>";
            echo "<td>".setColon($getLabel['f_label'])."</td>";
            echo "<td>";
            echo setFormValues($dataLabel[1]);
            echo "</td>";
            echo "</tr>";
        }
        ?>
        </table>
        <?php
    }
}
    
?>